﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="/css/Site.css" rel="stylesheet" type="text/css" />
    <link href="/css/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="/css/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="/scripts/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="/scripts/easyui-lang-zh_CN.js" type="text/javascript"></script>
</head>
<body>
    <table id="test" style="width: 700px" title="用户操作" iconcls="icon-edit"> 
    </table> 

    <script type="text/javascript">
        $(function () {
            //当页面首次刷新的时候执行的事件 
            initTable();
        });

        //实现对DataGird控件的绑定操作
        function initTable() {
            $('#test').datagrid({   //定位到Table标签，Table标签的ID是test
                url: '~/ajax/GetAllUserInfos.ashx',
                title: '菜单管理',  //标识
                iconCls: 'icon-save',
                width: 800,
                height: 350,
                nowrap: true,
                autoRowHeight: false,
                striped: true,
                collapsible: true,
                pagination: true,
                rownumbers: true,
                sortName: 'id',
                sortOrder: 'asc',
                remoteSort: true,
                idField: 'ID',
                frozenColumns: [[
                    { field: 'ck', checkbox: true },
                    { title: '主键', field: 'id', width: 80, sortable: true, hidden: true },
                    { title: '用户名', field: 'uname', width: 120, sortable: true },
                    { title: '邮箱', field: 'email', width: 100, sortable: true }
                ]],
                toolbar: [{
                    id: 'btnadd',
                    text: '添加',
                    iconCls: 'icon-add',
                    handler: function () {
                        $('#btnsave').linkbutton('enable');
                    }
                }, '-', {
                    id: 'btnedit',
                    text: '修改',
                    iconCls: 'icon-edit',
                    handler: function () {
                        $('#btncut').linkbutton('enable');
                    }
                }, '-', {
                    id: 'btndel',
                    text: '删除',
                    iconCls: 'icon-cancel'
                }],
                rowStyler: function (i, r) {
                    if (r.uname == 'hy8hy8') {
                        return 'background:red;';
                    }
                }
            });
        }
    </script>
</body>
</html>
